package cn.iocoder.yudao.module.planet.controller.app;

import cn.iocoder.yudao.module.planet.controller.app.dto.PlanetDTO;
import cn.iocoder.yudao.module.planet.controller.app.dto.PlanetCreateReqDTO;
import cn.iocoder.yudao.module.planet.controller.app.dto.PlanetUpdateReqDTO;
import cn.iocoder.yudao.module.planet.service.PlanetService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List;

/**
 * 星球管理控制器
 * 
 * @author 系统生成
 */
@RestController
@RequestMapping("/planet")
@Tag(name = "星球管理")
public class AppPlanetController {

    @Resource
    private PlanetService planetService;

    @PostMapping
    @Operation(summary = "创建星球")
    public Long createPlanet(@Valid @RequestBody PlanetCreateReqDTO createReqDTO) {
        return planetService.createPlanet(createReqDTO);
    }

    @PutMapping
    @Operation(summary = "更新星球")
    public void updatePlanet(@Valid @RequestBody PlanetUpdateReqDTO updateReqDTO) {
        planetService.updatePlanet(updateReqDTO);
    }

    @DeleteMapping("/{id}")
    @Operation(summary = "删除星球")
    public void deletePlanet(@PathVariable Long id) {
        planetService.deletePlanet(id);
    }

    @GetMapping("/{id}")
    @Operation(summary = "获取星球详情")
    public PlanetDTO getPlanet(@PathVariable Long id) {
        return planetService.getPlanet(id);
    }

    @GetMapping("/list-by-tenant/{tenantId}")
    @Operation(summary = "根据租户ID获取星球列表")
    public List<PlanetDTO> getPlanetListByTenantId(@PathVariable Long tenantId) {
        return planetService.getPlanetListByTenantId(tenantId);
    }

}